CVE-2025-5987
Libssh: invalid return code for chacha20 poly1305 with openssl backend
Description
A flaw was found in libssh when using the ChaCha20 cipher with the OpenSSL library. If an attacker manages to exhaust the heap space, this error is not detected and may lead to libssh using a partially initialized cipher context. This occurs because the OpenSSL error code returned aliases with the SSH_OK code, resulting in libssh not properly detecting the error returned by the OpenSSL library. This issue can lead to undefined behavior, including compromised data confidentiality and integrity or crashes.
INFO
Published Date :
July 7, 2025, 3:15 p.m.
Last Modified :
Aug. 22, 2025, 1:11 p.m.
Remotely Exploit :
Yes !
Source :
[email protected]
CVSS Scores
Score | Version | Severity | Vector | Exploitability Score | Impact Score | Source |
---|---|---|---|---|---|---|
CVSS 3.1 | MEDIUM | [email protected] | ||||
CVSS 3.1 | HIGH | [email protected] |
Solution
- Update libssh to a version that addresses the cipher initialization flaw.
- Verify OpenSSL error codes are handled correctly in cipher operations.
- Monitor heap usage to prevent exhaustion during cryptographic operations.
Public PoC/Exploit Available at Github
CVE-2025-5987 has a 1 public
PoC/Exploit
available at Github.
Go to the Public Exploits
tab to see the list.
References to Advisories, Solutions, and Tools
Here, you will find a curated list of external links that provide in-depth
information, practical solutions, and valuable tools related to
CVE-2025-5987
.
URL | Resource |
---|---|
https://access.redhat.com/security/cve/CVE-2025-5987 | Third Party Advisory |
https://bugzilla.redhat.com/show_bug.cgi?id=2376219 | Issue Tracking Third Party Advisory |
CWE - Common Weakness Enumeration
While CVE identifies
specific instances of vulnerabilities, CWE categorizes the common flaws or
weaknesses that can lead to vulnerabilities. CVE-2025-5987
is
associated with the following CWEs:
Common Attack Pattern Enumeration and Classification (CAPEC)
Common Attack Pattern Enumeration and Classification
(CAPEC)
stores attack patterns, which are descriptions of the common attributes and
approaches employed by adversaries to exploit the CVE-2025-5987
weaknesses.
We scan GitHub repositories to detect new proof-of-concept exploits. Following list is a collection of public exploits and proof-of-concepts, which have been published on GitHub (sorted by the most recently updated).
A powerful Kubernetes debugging tool that enables network capture, command execution, and file operations across multiple pods and nodes simultaneously through privileged debug pods.
Shell
Results are limited to the first 15 repositories due to potential performance issues.
The following list is the news that have been mention
CVE-2025-5987
vulnerability anywhere in the article.
The following table lists the changes that have been made to the
CVE-2025-5987
vulnerability over time.
Vulnerability history details can be useful for understanding the evolution of a vulnerability, and for identifying the most recent changes that may impact the vulnerability's severity, exploitability, or other characteristics.
-
Initial Analysis by [email protected]
Aug. 22, 2025
Action Type Old Value New Value Added CVSS V3.1 AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H Added CPE Configuration OR *cpe:2.3:a:libssh:libssh:-:*:*:*:*:*:*:* Added Reference Type Red Hat, Inc.: https://access.redhat.com/security/cve/CVE-2025-5987 Types: Third Party Advisory Added Reference Type Red Hat, Inc.: https://bugzilla.redhat.com/show_bug.cgi?id=2376219 Types: Issue Tracking, Third Party Advisory -
New CVE Received by [email protected]
Jul. 07, 2025
Action Type Old Value New Value Added Description A flaw was found in libssh when using the ChaCha20 cipher with the OpenSSL library. If an attacker manages to exhaust the heap space, this error is not detected and may lead to libssh using a partially initialized cipher context. This occurs because the OpenSSL error code returned aliases with the SSH_OK code, resulting in libssh not properly detecting the error returned by the OpenSSL library. This issue can lead to undefined behavior, including compromised data confidentiality and integrity or crashes. Added CVSS V3.1 AV:N/AC:H/PR:L/UI:N/S:U/C:L/I:L/A:L Added CWE CWE-393 Added Reference https://access.redhat.com/security/cve/CVE-2025-5987 Added Reference https://bugzilla.redhat.com/show_bug.cgi?id=2376219